<template>
  <div>
    <add-course @editOrAdd="addCourse" :ruleForm="ruleForm"></add-course>
  </div>
</template>
<script>
import AddCourse from '@/views/course/editOrAddCmp'
import {createUpdateClass} from '@/api/operation'
import {ERR_OK} from '@/api/config'
import {Message} from 'element-ui'
import { type } from 'os'
export default {
  data() {
    return{
      ruleForm: {
        class_id: "",
        class_hour: "",
        word: "",
        level: "",
        chapter_name: "",
        course_price: "",
        course_box_price: ""
      },
    }
  },
  components: {
    AddCourse
  },
  methods: {
    addCourse(params) {
      this._createUpdateClass(params)
    },
    _createUpdateClass(params) {
      createUpdateClass(params)
        .then((res) => {
          if (res.code == ERR_OK) {
            console.log(res)
            Message({
              message: '添加成功',
              type: 'info'
            })
          }
          
        })
        .catch((res) => {
          console.log(res)
        })
    }
  }
}
</script>
<style lang="scss" scoped>

</style>